//
//  ContactDetailViewController.m
//  test2
//
//  Created by 贺银银 on 16/3/29.
//  Copyright © 2016年 hyy. All rights reserved.
//

#import "ContactDetailViewController.h"
#import "ChatRoomViewController.h"
@interface ContactDetailViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel;
- (IBAction)chatAction:(UIButton *)sender;


@end

@implementation ContactDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.userNameLabel.text = self.userName;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)chatAction:(UIButton *)sender {
    
    [[CDChatManager manager] fetchConversationWithOtherId:self.userNameLabel.text callback:^(AVIMConversation *conversation, NSError *error) {
        
        ChatRoomViewController *chatRoomVC = [[ChatRoomViewController alloc]initWithConversation:conversation];
        [self.navigationController pushViewController:chatRoomVC animated:YES];
        
    }];
    
    
}
@end
